
class _Basic {
    constructor(x, y, zIndex) {
        this.CacheEvent = CacheEvent;
        this.ContentGrounp = new PIXI.Container();
        this.ContentGrounp.zIndex = zIndex;
        this.ContentGrounp.position.set(x, y);
        this.positionCache = [x, y];
    }
    Base_AddChild(item) {
        this.ContentGrounp.addChild(item);
    }
    Base_Move(x, y, callback) {
        x !== null && (this.ContentGrounp.x = x);
        y !== null && (this.ContentGrounp.y = y);
        callback && callback(x, y);
    }
    Base_SetPositionCache(x, y) {
        let _x = parseFloat(x) || parseFloat(x) === 0 ? x : this.positionCache[0];
        let _y = parseFloat(y) || parseFloat(y) === 0 ? y : this.positionCache[1];
        this.positionCache = [_x, _y];
    }
    Base_Value() {
        return {
            x: this.positionCache[0],
            y: this.positionCache[1],
            zIndex: this.ContentGrounp.zIndex,
        }
    }
    Base_FormOption() {
        return [{
            label: 'X轴坐标',
            key: 'x',
            value: this.ContentGrounp.x.toFixed(2),
            type: 'number',
        }, {
            label: 'Y轴坐标',
            key: 'y',
            value: this.ContentGrounp.y.toFixed(2),
            type: 'number',
        }]
    }
    Base_SetValue(key, value) {
        if (key == 'x') {
            this.Base_Move(value, null);
            this.Base_SetPositionCache(value, null);
        };
        if (key == 'y') {
            this.Base_Move(null, value);
            this.Base_SetPositionCache(null, value);
        };
    }
}


export default _Basic;